From a540583964c7009cb4543ae1128e52a346f7ff55 Mon Sep 17 00:00:00 2001 From: "cl349@arcadians.cl.cam.ac.uk" Date: Thu, 25 Nov 2004 14:07:37 +0000 Subject: [PATCH] bitkeeper revision 1.1159.194.3 (41a5e729R9jXVAOcrKU-Xq81RscJQQ) vbd.c, block.h: Fix mapping from Xen device numbers to Linux device names. --- linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h | 3 ++- linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h b/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h index ace010e0fb..f50ce03bca 100644 --- a/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h +++ b/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h @@ -64,6 +64,7 @@ struct xlbd_type_info { int partn_shift; + int partn_per_major; int devs_per_major; int hardsect_size; int max_sectors; @@ -77,8 +78,8 @@ struct xlbd_type_info { */ struct xlbd_major_info { int major; + int index; int usage; - int xd_device; struct xlbd_type_info *type; }; diff --git a/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c b/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c index d2cfb7cf5a..684db78e99 100644 --- a/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c +++ b/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c @@ -44,6 +44,7 @@ static struct xlbd_type_info xlbd_ide_type = { .partn_shift = 6, + .partn_per_major = 2, // XXXcl todo blksize_size[major] = 1024; .hardsect_size = 512, .max_sectors = 128, /* 'hwif->rqsize' if we knew it */ @@ -53,6 +54,7 @@ static struct xlbd_type_info xlbd_ide_type = { static struct xlbd_type_info xlbd_scsi_type = { .partn_shift = 4, + .partn_per_major = 16, // XXXcl todo blksize_size[major] = 1024; /* XXX 512; */ .hardsect_size = 512, .max_sectors = 128*8, /* XXX 128; */ @@ -62,6 +64,7 @@ static struct xlbd_type_info xlbd_scsi_type = { static struct xlbd_type_info xlbd_vbd_type = { .partn_shift = 4, + .partn_per_major = 16, // XXXcl todo blksize_size[major] = 512; .hardsect_size = 512, .max_sectors = 128, @@ -167,13 +170,17 @@ static struct xlbd_major_info *xlbd_get_major_info(int xd_device, int *minor) switch (mi_idx) { case 0 ... (NUM_IDE_MAJORS - 1): major_info[mi_idx]->type = &xlbd_ide_type; + major_info[mi_idx]->index = mi_idx; break; case NUM_IDE_MAJORS ... (NUM_IDE_MAJORS + NUM_SCSI_MAJORS - 1): major_info[mi_idx]->type = &xlbd_scsi_type; + major_info[mi_idx]->index = mi_idx - NUM_IDE_MAJORS; break; case (NUM_IDE_MAJORS + NUM_SCSI_MAJORS) ... (NUM_IDE_MAJORS + NUM_SCSI_MAJORS + NUM_VBD_MAJORS - 1): major_info[mi_idx]->type = &xlbd_vbd_type; + major_info[mi_idx]->index = mi_idx - + (NUM_IDE_MAJORS + NUM_SCSI_MAJORS); break; } major_info[mi_idx]->major = new_major; @@ -222,7 +229,8 @@ static struct gendisk *xlvbd_get_gendisk(struct xlbd_major_info *mi, gd->fops = &xlvbd_block_fops; gd->private_data = di; sprintf(gd->disk_name, "%s%c%d", mi->type->name, - 'a' + (xd_minor >> mi->type->partn_shift), + 'a' + mi->index * mi->type->partn_per_major + + (xd_minor >> mi->type->partn_shift), xd_minor & ((1 << mi->type->partn_shift) - 1)); /* sprintf(gd->devfs_name, "%s%s/disc%d", mi->type->name, , ); XXXdevfs */ -- 2.30.2